﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace unifiqAnthony
{
    public partial class Login : PhoneApplicationPage
    {
        public Login()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

            AzureSvc.Service1Client client = new AzureSvc.Service1Client();
            client.loginAsync(textBox1.Text);
            client.loginCompleted += new EventHandler<AzureSvc.loginCompletedEventArgs>(client_loginCompleted);
            App.LoginInfo.uid = 1;
            
        }

        private void client_loginCompleted(object sender, AzureSvc.loginCompletedEventArgs e)
        {
            if (e.Result == 0 )
            {
                textBlock3.Visibility = Visibility.Visible;
            }
            else
            {
                textBlock3.Visibility = Visibility.Collapsed;
                App.LoginInfo.uid = e.Result;
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
        }
    }
}